00001
00002
00003
00004
00005
00006
#if !defined(AFX_REGTOOL_H__EBCBF331_598F_11D2_A553_000502DD3AA8__INCLUDED_)
00007 #define AFX_REGTOOL_H__EBCBF331_598F_11D2_A553_000502DD3AA8__INCLUDED_
00008
00009
#ifdef SWSERVICES_EXPORTS
00010
#define SWSERVICES_API __declspec(dllexport)
00011
#else
00012 #define SWSERVICES_API __declspec(dllimport)
00013
#endif
00014
00015
#if _MSC_VER >= 1000
00016
#pragma once
00017
#endif // _MSC_VER >= 1000
00018
00019
#include "Stdafx.h"
00020
#include <string>
00021
00022
class CXMLReg;
00023
00063 class SWSERVICES_API DFRegTool
00064 {
00065
#pragma warning( push )
00066
#pragma warning( disable : 4251 )
00067
00068
public:
00069
00072 DFRegTool();
00073
virtual ~DFRegTool();
00075
00078 LONG OpenKey();
00079 LONG OpenKey(
const CAtlString&);
00080 LONG OpenKey(
const std::wstring&);
00081 LONG OpenKey(
const TCHAR*);
00082 LONG OpenKey(DWORD&);
00083 LONG OpenKey(
const CAtlString&, DWORD&);
00084 LONG OpenKey(
const std::wstring&, DWORD&);
00085 LONG OpenKey(
const TCHAR*, DWORD&);
00086 LONG CloseKey();
00088
00099 LONG AddDword(LPCTSTR key, DWORD value);
00100
00102
00112 LONG GetDword(LPCTSTR key, DWORD& value);
00113 LONG GetDword(LPCTSTR key,
int& value);
00114 LONG GetDword(LPCTSTR key,
bool& value);
00116
00117
00125 LONG AddStr(LPCTSTR key, LPCTSTR value);
00126 LONG AddStr(LPCTSTR key,
const CAtlString& value);
00127 LONG AddStr(LPCTSTR key,
const std::wstring& value);
00128 LONG GetStr(LPCTSTR key, LPTSTR, DWORD value);
00129 LONG GetStr(LPCTSTR key, CAtlString& value);
00130 LONG GetStr(LPCTSTR key, std::wstring& value);
00132
00146 LONG AddCodedStr(LPCTSTR key,
const CAtlString& value,
int codeA,
int codeB);
00147 LONG AddCodedStr(LPCTSTR key,
const std::wstring& value,
int codeA,
int codeB);
00148 LONG AddCodedStr(LPCTSTR key,
const TCHAR* value,
int codeA,
int codeB);
00149 LONG GetCodedStr(LPCTSTR key, CAtlString& value,
int codeA,
int codeB);
00150 LONG GetCodedStr(LPCTSTR key, std::wstring& value,
int codeA,
int codeB);
00152
00155 LONG DeleteContents();
00156 LONG DeleteFolder(LPCTSTR);
00157 LONG DeleteKey(LPCTSTR);
00159
00162 LONG Replicate(
const DFRegTool&);
00164
00167 LONG NextKey(CAtlString &strFileName,
int iSetBack = 0);
00168 LONG NextKey(std::wstring &strFileName,
int iSetBack = 0);
00169 LONG NextValue(CAtlString &strValueName,
int iSetBack = 0);
00170 LONG NextValue(std::wstring &strValueName,
int iSetBack = 0);
00172
00175 LONG BeginExportToXML();
00176 LONG ExportKeyToXML(LPCTSTR szKeyName, DFRegTool& regKey);
00177 LONG EndExportToXML(LPCTSTR szFileName);
00178 LONG BeginImportFromXML( LPCTSTR szFileName );
00179 LONG ImportFromXML( LPCTSTR szKeyName, CXMLReg& xmlImport );
00180 LONG EndImportFromXML();
00181 CXMLReg* GetXMLImporter();
00182 CXMLReg* GetXMLExporter();
00184
00185
protected:
00186 enum FetchType
00187 {
00188 Readable,
00189 Encoded,
00190 Whole
00191 };
00192
00193 LONG DeleteHelper(HKEY hParentKey);
00194 LONG ExportHelper(CXMLReg& xmlFile, HKEY hCurrentKey);
00195 LONG ImportHelper(CXMLReg& xmlFile, HKEY hCurrentKey);
00196 LONG ReplicateHelper(HKEY hParentKey, HKEY hCopyFromParentKey);
00197 LONG GetStrInternal(HKEY hKey, LPCTSTR string, std::wstring &lpszData, FetchType type);
00198 LONG GetDwordInternal( HKEY hKey, LPCTSTR string, DWORD &dwWord);
00199 CAtlString BasePath;
00200 HKEY m_hIp;
00201 CXMLReg* m_xmlExportFile;
00202 CXMLReg* m_xmlImportFile;
00203
00204
#pragma warning( pop )
00205
};
00206
00207
#endif // !defined(AFX_REGTOOL_H__EBCBF331_598F_11D2_A553_000502DD3AA8__INCLUDED_)